<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />

<html>
	<head>
		<title>店铺管理</title>

		<script>
	$(document).ready(function() {
		//聚焦第一个输入框
		$("#shopSource_shopName").focus();
		//为inputForm注册validate函数
		$("#inputForm").validate();
	});

	function hideShow(item) {
		var items = item.split("-");
		for(var i=0;i<items.length;i++){
		   if(i==items.length-1){
		     $("#" + items[i]).show();
		   }else{
		     $("#" + items[i]).hide();
		   }
		}
	}

	function sourceChange(item) {
		item = item.split("--")[0];
		if ("jd" == item) {
			hideShow("frId-omsId-mlsId-wdgj-ocrId-htId-jdId");
		} else if ("ht" == item) {
			hideShow("frId-omsId-mlsId-wdgj-ocrId-jdId-htId");
		} else if ("ocr" == item) {
			hideShow("frId-omsId-mlsId-wdgj-jdId-htId-ocrId");
		}else if("wdgj"==item){
		    hideShow("frId-omsId-mlsId-jdId-htId-ocrId-wdgj");
		}else if("mls"==item){
			hideShow("frId-omsId-jdId-htId-ocrId-wdgj-mlsId");
		}else if("oms"==item){
			hideShow("frId-jdId-htId-ocrId-wdgj-mlsId-omsId");
		}else if("fr"==item){
			hideShow("jdId-htId-ocrId-wdgj-mlsId-omsId-frId");
		}
	}
</script>
	</head>

	<body>
	<section class="content">
<div class="row">
		<div class="col-md-12">

			<!-- Primary box -->
			<div class="box box-solid box-primary">
				<div class="box-header">
					<i class="fa fa-edit"></i>
					<h3 class="box-title">${function }</h3>
					<div class="box-tools pull-right">
						<button class="btn btn-primary btn-sm" data-widget="collapse">
							<i class="fa fa-minus"></i>
						</button>
					</div>
				</div>
				<div class="box-body">
		<form id="inputForm" action="${ctx}/v2/shopSource/${action}"
			method="post" class="form-horizontal">
			<input type="hidden" name="id" value="${shopSource.id}" />
			<input type="hidden" name="shopCode" value="${shopSource.shopCode}" />
			<fieldset>
				<div class="form-group">
					<label for="shopSource_shopName" class="col-sm-3 control-label">
						店铺名称:
					</label>
					<div class="col-sm-6">
						<input type="text" id="shopSource_shopName" name="shopName"
							value="${shopSource.shopName}" class="form-control input-large required"
							minlength="2" />
							</div>
				</div>
				<div class="form-group">
					<label for="shopSource_customerCode" class="col-sm-3 control-label">
						所属商家:
					</label>
					<div class="col-sm-6">
						<select id="customerCode" name="customerCode"  class="form-control">
							<c:forEach items="${customers}" var="obj">
								<option value="${obj.customerCode}"
									<c:if test="${obj.customerCode eq shopSource.customerCode}">selected="selected"</c:if>>
									${obj.customerName}
								</option>
							</c:forEach>
						</select>
					</div>
				</div>
				
				<div class="form-group">
					<label for="orderSourceCode" class="col-sm-3 control-label">
						数据来源:
					</label>
					<div class="col-sm-6">
						<select id="ordenoSourceCode" name="ordenoSourceCode" onchange="sourceChange(this.value)" class="form-control">
							<c:forEach items="${ordenoSource}" var="obj">
								<option value="${obj.ordenoSourceCode}" <c:if test="${obj.ordenoSourceCode eq shopSource.ordenoSourceCode}">selected="selected"</c:if>>
									${obj.ordenoSourceName}
								</option>
							</c:forEach>
						</select>
					</div>
				</div>


				<div id="ocrId" style="display: none;">
					<div class="form-group">
						<label for="ocrKey" class="col-sm-3 control-label">
							appKey信息:
						</label>
						<div class="col-sm-6">
							<input type="text" id="ocrKey" name="ocrKey"
								value="${shopSource.ocrKey}" class="form-control input-large required"/>
						</div>
					</div>
					
					<div class="form-group">
						<label for="ocrSecret" class="col-sm-3 control-label">
							appSecret信息:
						</label>
						<div class="col-sm-6">
							<input type="text" id="ocrSecret" name="ocrSecret"
								value="${shopSource.ocrSecret}" class="form-control input-large required"/>
					</div>
					</div>
					
					<div class="form-group ">
						<label for="ocrWebservice" class="col-sm-3 control-label">
							webservice接口:
						</label>
						<div class="col-sm-6">
							<input type="text" id="ocrWebservice" name="ocrWebservice"
								value="${shopSource.ocrWebservice}" class="form-control input-large required"/>
					</div>
					</div>
					
				</div>
				<!-- 网店管家 -->
				<div id="wdgj" style="display: none;">
					
				</div>
				<!-- 美丽说 -->
                <div id="mlsId" style="display: none;">
					
				</div>
				
				<!-- 能容OMS -->
                <div id="omsId" style="display: none;">
					
				</div>
				
				<!-- 富润 -->
                <div id="frId" style="display: none;">
					
				</div>
				<div id="htId" style="display: none;">
					<div class="form-group ">
						<label for="htKey" class="col-sm-3 control-label">
							appKey信息:
						</label>
						<div class="col-sm-6">
							<input type="text" id="htKey" name="htKey"
								value="${shopSource.htKey}" class="form-control input-large required"/>
					</div>
					</div>
					
					<div class="form-group">
						<label for="htSecret" class="col-sm-3 control-label">
							appSecret信息:
						</label>
						<div class="col-sm-6">
							<input type="text" id="htSecret" name="htSecret"
								value="${shopSource.htSecret}" class="form-control input-large required"/>
					</div>
					</div>
					
					<div class="form-group">
						<label for="htInf" class="col-sm-3 control-label">
							订单接口:
						</label>
						<div class="col-sm-6">
							<input type="text" id="htInf" name="htInf"
								value="${shopSource.htInf}" class="form-control input-large required"
								 />
					</div>
					</div>

					<div class="form-group">
						<label for="htStockUser" class="col-sm-3 control-label">
							库存htStockUser信息:
						</label>
						<div class="col-sm-6">
							<input type="text" id="htStockUser" name="htStockUser"
								value="${shopSource.htStockUser}" class="form-control input-large required"
								 />
					</div>
					</div>
					
					<div class="form-group">
						<label for="htStockSign" class="col-sm-3 control-label">
							库存htStockSign信息:
						</label>
						<div class="col-sm-6">
							<input type="text" id="htStockSign" name="htStockSign"
								value="${shopSource.htStockSign}" class="form-control input-large required"
								 />
					</div>
					</div>
					
					<div class="form-group ">
						<label for="htStockSku" class="col-sm-3 control-label">
							发货接口:
						</label>
						<div class="col-sm-6">
							<input type="text" id="htSendUrl" name="htSendUrl"
								value="${shopSource.htSendUrl}" class="form-control input-large required"
								 />
					</div>
					</div>
					
					
					<div class="form-group">
						<label for="htStockSku" class="col-sm-3 control-label">
							SKU库存接口:
						</label>
						<div class="col-sm-6">
							<input type="text" id="htStockSku" name="htStockSku"
								value="${shopSource.htStockSku}" class="form-control input-large required"
								 />
					</div>
					</div>
					
					<div class="form-group">
						<label for="htStockSku" class="col-sm-3 control-label">
							禾塘店铺ID:
						</label>
						<div class="col-sm-6">
							<input type="text" id="htShopId" name="htShopId"
								value="${shopSource.htShopId}" class="form-control input-large required"
								 />
					</div>
					</div>

				</div>

				<div id="jdId" style="display: none;">
					<div class="form-group">
						<label for="jdKey" class="col-sm-3 control-label">
							appKey信息:
						</label>
						<div class="col-sm-6">
							<input type="text" id="jdKey" name="jdKey"
								value="${shopSource.jdKey}" class="form-control input-large required"
								 />
					</div>
					</div>
					
					<div class="form-group">
						<label for="jdSecret" class="col-sm-3 control-label">
							appSecret信息:
						</label>
						<div class="col-sm-6">
							<input type="text" id="jdSecret" name="jdSecret"
								value="${shopSource.jdSecret}" class="form-control input-large required"
								 />
					</div>
					</div>
					
					<div class="form-group ">
						<label for="jdBackServerUrl" class="col-sm-3 control-label">
							回调URL:
						</label>
						<div class="col-sm-6">
							<input type="text" id="jdBackServerUrl" name="jdBackServerUrl"
								value="${shopSource.jdBackServerUrl}"
								class="form-control input-large required"  />
					</div>
					</div>
					
					
					<div class="form-group ">
						<label for="shopSource_customerType" class="col-sm-3 control-label">
							商家类型:
						</label>
						<div class="col-sm-6">
							<select id="shopSource_customerType" name="customerType" class="form-control">
								<option value="SOPL"
									<c:if test="${shopSource.customerType eq 'SOPL'}">selected="selected"</c:if>>
									SOPL
								</option>
								<option value="LBP"
									<c:if test="${shopSource.customerType eq 'LBP'}">selected="selected"</c:if>>
									LBP
								</option>
								<option value="SOP"
									<c:if test="${shopSource.customerType eq 'SOP'}">selected="selected"</c:if>>
									SOP
								</option>
							</select>
					</div>
					</div>

				</div>


                 <div class="form-group">
					<label for="areagroupLists" class="col-sm-3 control-label">
						快递公司限制:
					</label>
					<div class="col-sm-6">
						<select id="expressCodes" name="expressCodes"  multiple="multiple" class="form-control">
							<c:forEach items="${companys}" var="obj">
								<option value="${obj.companyCode }" <c:forEach items="${shopSource.listExpressCodes}" var="o"><c:if test="${o eq obj.companyCode }">selected="selected"</c:if></c:forEach>>
									${obj.companyName }
								</option>
							</c:forEach>
						</select>
				</div>
				</div>

                   <div class="form-group">
						<label for="jdKey" class="col-sm-3 control-label">
							发票:
						</label>
						<div class="col-sm-6">
							<input type="radio" class="form-control" name="billNo" value="yes" <c:if test="${shopSource.billNo eq 'yes' }">checked="checked"</c:if> />接收
							<input type="radio" class="form-control" name="billNo" value="no"  <c:if test="${shopSource.billNo eq 'no' }">checked="checked"</c:if>/>不接收
					</div>
					</div>
					
					 <div class="form-group ">
						<label for="jdSecret" class="col-sm-3 control-label">
							订单类型限制:
						</label>
						<div class="col-sm-6">
							<input type="radio" class="form-control" name="orderType" value="single" <c:if test="${shopSource.orderType eq 'single' }">checked="checked"</c:if>/>单件
							<input type="radio" class="form-control" name="orderType" value="multiple" <c:if test="${shopSource.orderType eq 'multiple' }">checked="checked"</c:if>/>多件
							<input type="radio" class="form-control" name="orderType" value="-1" <c:if test="${shopSource.orderType eq '-1' }">checked="checked"</c:if>/>不限制
						</div>
					</div>
					
					
					 <div class="form-group ">
						<label for="jdBackServerUrl" class="col-sm-3 control-label">
							货到付款:
						</label>
						<div class="col-sm-6">
							<input type="radio" name="payAfter" class="form-control" value="yes" <c:if test="${shopSource.payAfter eq 'yes' }">checked="checked"</c:if> />接收
							<input type="radio" name="payAfter" class="form-control" value="no"  <c:if test="${shopSource.payAfter eq 'no' }">checked="checked"</c:if> />不接收
						</div>
					</div>

					<div class="form-group ">
						<label for="" class="col-sm-3 control-label">
							是否打保修单:
						</label>
						<div class="col-sm-6">
							<input type="radio" name="guaranteeStatus" class="form-control" value="yes" <c:if test="${shopSource.guaranteeStatus eq 'yes' }">checked="checked"</c:if> />打印
							<input type="radio" name="guaranteeStatus" class="form-control" value="no"  <c:if test="${shopSource.guaranteeStatus eq 'no' }">checked="checked"</c:if> />不打印
						</div>
					</div>
					
				 <div class="form-group">
					<label for="shopSource_status" class="col-sm-3 control-label">
						状态:
					</label>
					<div class="col-sm-6">
						<input type="radio" value="delete" name="status"
							class="form-control input-large required"
							<c:if test="${shopSource.status eq 'delete'}">checked="checked"</c:if>>
						删除
						<input type="radio" value="normal" name="status"
							class="form-control input-large required"
							<c:if test="${shopSource.status eq 'normal'}">checked="checked"</c:if>>
						正常

					</div>
				</div>
				<script type="text/javascript">
	var value = $("#ordenoSourceCode").val();

	sourceChange(value);
</script>

				<div class="modal-footer bg-gray">
					<input id="submit_btn" class="btn btn-primary" type="submit"
						value="提交" />
					<input id="cancel_btn" class="btn" type="button" value="返回"
						onclick="history.back()" />
				</div>
				</fieldset>
		</form>
		</div>
		</div>
		</div>
		</div>
		</section>
	</body>
</html>
